package com.javacasino.casino.config;

import com.javacasino.casino.util.CustomizedWebSocketClient;
import lombok.extern.slf4j.Slf4j;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.drafts.Draft_6455;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.net.URI;


@Slf4j
@Configuration
public class WebSocketConfig {

    @Value("${socketUri}")
    private String webSocketUri;

    @Bean
    public WebSocketClient webSocketClient(){
        try {
            CustomizedWebSocketClient customizedWebSocketClient = new CustomizedWebSocketClient(new URI("wss://dianzizone.com/fxCasino/fxLB?gameType=5902"),new Draft_6455());
            customizedWebSocketClient.connect();

            return customizedWebSocketClient;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}
